package com.lj.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lj.mapper.AdminMapper;
import com.lj.pojo.Admin;
import com.lj.pojo.AdminExample;
import com.lj.pojo.Stafflj;
import com.lj.pojo.StaffljExample;
import com.lj.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    AdminMapper adminMapper;
    @Override
    public Admin login(String name, String pwd) {
        AdminExample example=new AdminExample();
        example.createCriteria().andUsernameEqualTo(name);
        List<Admin> list=adminMapper.selectByExample(example);
        if(list.size()>0){
            Admin admin=list.get(0);
            if(admin.getPassword().equals(pwd)){
                return admin;
            }
        }
        return null;
    }


}
